#include "Jaccard.h"

Jaccard::Jaccard() {
}


Jaccard::~Jaccard() {
}

Jaccard * Jaccard::instance = 0;

Jaccard * Jaccard::getInstance() {
	if (!instance){
		instance = new Jaccard();
	}
	return instance;
}

double Jaccard::Similarity(HashSet* h1, HashSet* h2){
    unsigned int intersection = 0;
    for (int i=0; i < DEF_NUM_MINHASH; i++)
        if (h1->GetElem(i) == h2->GetElem(i))
            intersection++;
    return (1.0 * intersection) / DEF_NUM_MINHASH;
}